jQuery(document).ready(function($) {
    $('#submit_cp').click(function() {
        var coupon_code = $('input[name="coupon_code"]').val();
        var store_name = $('input[name="store_name"]').val();
        var des_cp = $('textarea[name="des_cp"]').val();
        var security_code = $('input[name="6_letters_code"]').val();
        var title_coupon = $('input[name="title_coupon"]').val();
        var domain_missing = $('div.domain-missing');
        var code_missing = $('div.code-missing');
        var des_missing = $('div.des-missing');
        var captcha_missing = $('div.captcha-missing');
        var title_missing = $('div.title-missing');
        if (store_name.length == 0) {
            domain_missing.removeClass('hiden');
        } else {
            domain_missing.addClass('hiden');
        }
        if (title_coupon.length == 0) {
            title_missing.removeClass('hiden');
        } else {
            title_missing.addClass('hiden');
        }
        if (coupon_code.length == 0) {
            code_missing.removeClass('hiden');
        } else {
            code_missing.addClass('hiden');
        }
        if (des_cp.length == 0) {
            des_missing.removeClass('hiden');
        } else {
            des_missing.addClass('hiden');
        }
        if (security_code.length == 0) {
            captcha_missing.removeClass('hiden');
        } else {
            captcha_missing.addClass('hiden');
        }
        if (store_name.length != 0 && title_coupon.length != 0 && coupon_code.length != 0 && des_cp.length != 0 && security_code.length != 0) {
            return true;
        }
        return false;
    });
    $('#submit_comment').click(function() {
        var comment = $('textarea[name="comment_content"]').val();
        if (comment.length == 0) {
            return false;
        } else {
            return true;
        }
    });
});